package com.ruoyi.system.service;

import java.util.List;
import java.util.Map;

import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.EventAndTopic;
import com.ruoyi.system.domain.PoPublicOpinion;
import com.ruoyi.system.domain.PublicOpinionEvents;
import com.ruoyi.system.domain.vo.*;

/**
 * 舆情Service接口
 *
 * @author ruoyi
 * @date 2021-06-07
 */
public interface IPoPublicOpinionService {


    /**
     * 批量新增舆情
     *
     * @param opinions 舆情
     * @return 结果
     */
    int insertPoPublicOpinionBatch(List<PoPublicOpinion> opinions);

    /**
     * 查询舆情
     *
     * @param id 舆情ID
     * @return 舆情
     */
    public PoPublicOpinion selectPoPublicOpinionById(String id);

    /**
     * 查询舆情列表
     *
     * @param poPublicOpinion 舆情
     * @return 舆情集合
     */
    public List<PoPublicOpinion> selectPoPublicOpinionList(PoPublicOpinion poPublicOpinion);


    /**
     * 新增舆情
     *
     * @param poPublicOpinion 舆情
     * @return 结果
     */
    public int insertPoPublicOpinion(PoPublicOpinion poPublicOpinion);

    /**
     * 修改舆情
     *
     * @param poPublicOpinion 舆情
     * @return 结果
     */
    public int updatePoPublicOpinion(PoPublicOpinion poPublicOpinion);

    /**
     * 批量删除舆情
     *
     * @param ids 需要删除的舆情ID
     * @return 结果
     */
    public int deletePoPublicOpinionByIds(Long[] ids);

    /**
     * 删除舆情信息
     *
     * @param id 舆情ID
     * @return 结果
     */
    public int deletePoPublicOpinionById(Long id);


    /**
     * 获取所有的舆情
     *
     * @return
     */
    long getAllOpinionCount(PublicOpinionEvents event, EventParameterVo parameter, List<String> bindIds);

    /**
     * 获取所有Positive的舆情
     *
     * @return
     */
    long getPositiveOpinionCount(PublicOpinionEvents event, EventParameterVo parameter, List<String> bindIds);

    /**
     * 获取所有Neutral的舆情
     *
     * @return
     */
    long getNeutralOpinionCount(PublicOpinionEvents event, EventParameterVo parameter, List<String> bindIds);

    /**
     * 获取所有Negative的舆情
     *
     * @return
     */
    long getNegativeOpinionCount(PublicOpinionEvents event, EventParameterVo parameter, List<String> bindIds);


    List<CountResultVo> queryMediaTypeByEventId(Long eventId, EventParameterVo parameterVo);


    List<CountResultVo> queryMediaTypeByEventId(EventQueryParameterVo vo);


    List<String> getAllMediaType();

    /**
     * 获取事件的情感统计
     *
     * @param eventId
     * @return
     */
    OpTypeNumVM getTypeNumEvent(Long eventId, EventParameterVo parameter, List<String> bindIds);


    /**
     * 按媒体名称统计
     *
     * @param eventId
     * @param parameter
     * @param bindIds
     * @return
     */

    List<NameValue> getMediaNameNum(Long eventId, EventParameterVo parameter, List<String> bindIds);

    List<NameListValue> groupSensitiveOpinionDayHour(String sensitiveInformation, EventParameterVo parameter);

    List<NameValue> getMediaTypeNum(Long eventId, EventParameterVo parameter, List<String> bindIds);


    List<OpMediaNameNumVM> getMediaOverseasNum(List<String> opinionIds);

    List<NameValue> getOpinionByLanguageTypeCounts(List<String> opinionIds);

    int updateSensitiveInformation(String[] ids, String sensitive);

    int joinTheForecast(String[] ids, String level, Long userId, Long deptId, String tenantCode);

    int removeTheForecast(String[] ids, Long userId, Long deptId, String tenantCode);

    List<PoPublicOpinion> selectPoPublicOpinionListByIds(String[] ids);

    PageInfo<PoPublicOpinion> queryWarningList(OpinionParameterVo opinionParameterVo, Integer pageNum, Integer pageSize);

    List<NameValue> getForecastMediaType(OpinionParameterVo opinionParameterVo);

    /**
     * 获取时间段内的预警数量
     *
     * @param beginPublishDay
     * @param endPublishDay
     * @return
     */
    long getWarningCount(String beginPublishDay, String endPublishDay);


    EventParameterVo buildParameter(String timeType, String beginPublishDay, String endPublishDay);


    /**
     * 获取最新的舆情
     *
     * @return
     */
    List<PoPublicOpinion> selectPoPublicOpinionListNewest(int count);


    /**
     * 首发媒体
     *
     * @param eventId
     * @param parameter
     * @param bindIds
     * @return
     */
    List<PoPublicOpinion> getStartingMedia(Long eventId, EventParameterVo parameter, List<String> bindIds);


    /**
     * 根据事件
     * 舆情按日期，媒体名分组
     *
     * @param eventId
     * @param beginPublishDay
     * @param endPublishDay
     * @return
     */
    List<NameListValue> getCountsByPublishDayMediaName(Long eventId, String beginPublishDay, String endPublishDay);


    /**
     * 舆情加入收藏
     *
     * @param ids
     * @param userId
     * @param deptId
     * @param tenantCode
     * @return
     */
    int addToFavorites(String[] ids, Long userId, Long deptId, String tenantCode);

    /**
     * 获取收藏id集合
     *
     * @return
     */
    List<String> getFavoriteIds(String tenantCode);

    /**
     * 获取收藏的舆情列表
     *
     * @param userId
     * @param deptId
     * @param tenantCode
     * @return
     */
    PageInfo<PoPublicOpinion> getFavorites(Long userId, Long deptId, String tenantCode, Integer pageNum, Integer pageSize);

    /**
     * 舆情移除收藏
     *
     * @param ids
     * @return
     */
    int removeFavorites(String[] ids, Long userId, Long deptId, String tenantCode);

    /**
     * 热点舆情
     *
     * @param beginPublishDay
     * @param endPublishDay
     * @return
     */
    List<PoPublicOpinion> hotPublicOpinion(String beginPublishDay, String endPublishDay, int count);

    /**
     * 热点舆情
     *
     * @param eventId
     * @param beginPublishDay
     * @param endPublishDay
     * @param informationType
     * @return
     */
    PageInfo<PoPublicOpinion> hotPublicOpinion(Long eventId, String beginPublishDay, String endPublishDay, Integer pageNum, Integer pageSize, Integer informationType);

    /**
     * 获取事件相关的所有舆情列表
     *
     * @param eventId
     * @return
     */
    List<PoPublicOpinion> selectPoPublicOpinionListEventId(Long eventId);


    /**
     * 获取指定个数的事件关联地名
     *
     * @param maxCount
     * @return
     */
    List<NameValue> getLocationCount(List<String> opinionIds, int maxCount);

    /**
     * 获取指定个数的事件关联人物
     *
     * @param maxCount
     * @return
     */
    List<NameValue> getPersonCount(List<String> opinionIds, int maxCount);


    Map<String, Object> comprehensiveStatisticsThisYear();


    List<KeywordInfo> getHotWords(String id);


    PageInfo<PoPublicOpinion> getOpinionsOfSameAuthorById(String id, String author, Integer pageNum, Integer pageSize);

    /**
     * 事件情感载体分析
     *
     * @param eventId
     * @param parameter
     * @param bindIds
     * @return
     */
    List<NameListValue> getMediaTypeSensitiveDayNumEvent(Long eventId, EventParameterVo parameter, List<String> bindIds);


    /**
     * 事件正负面观点分析
     *
     * @param event
     * @param bindIds
     * @return
     */
    List<PoPublicOpinion> getViewpointAnalysis(PublicOpinionEvents event, EventParameterVo parameter, List<String> bindIds);

    /**
     * 相似文章
     *
     * @param id
     * @param title
     * @param pageNum
     * @param pageSize
     * @return
     */
    PageInfo<PoPublicOpinion> getOpinionsOfSimilarArticlesById(String id, String title, Integer pageNum, Integer pageSize);

    List<OpMediaNameSensitiveDayNumVM> countSensitiveOpinionByMediaName(Long eventId, EventParameterVo parameter, List<String> bindIds);

    List<OpAuthorSensitiveDayNumVM> countSensitiveAuthorOpinion(Long eventId, EventParameterVo parameter, List<String> bindIds);

    List<NameValue> getCountGroupByPublishDate(Long eventId, EventParameterVo parameter, List<String> bindIds);

    /**
     * 获取关联人物
     */
    List<String> getRelationPersonNames(String id);

    /**
     * 获取关联地域
     */
    List<String> getRelationLocationNames(String id);

    /**
     * 获取关联机构
     */
    List<String> getRelationOrganizationNames(String id);


    /**
     * 检索军犬数据
     *
     * @param parameter
     * @param pageNum
     * @param pageSize
     * @return
     */
    AjaxResult queryOpinionByDataServer(SearchParameterVo parameter, Integer pageNum, Integer pageSize);

    /**
     * 数据本地化
     *
     * @param parameter
     * @param pageNum
     * @param pageSize
     * @return
     */
    AjaxResult downloadDataFromServeCenter(SearchParameterVo parameter, Integer pageNum, Integer pageSize);

    /**
     * 数据本地化
     *
     * @param parameter
     * @param pageNum
     * @param pageSize
     * @return
     */
    AjaxResult downloadCsvDataFromServeCenter(SearchParameterVo parameter, Integer pageNum, Integer pageSize);


    /**
     * 负面舆情
     *
     * @param beginPublishDay
     * @param endPublishDay
     * @param count
     * @return
     */
    List<PoPublicOpinion> getNegativePublicOpinion(String beginPublishDay, String endPublishDay, int count);

    /**
     * 获取正负面信息趋势图
     *
     * @return
     */
    List<NameListValue> getSentimentByPublishTime(String beginPublishDay, String endPublishDay);

    List<EventAndTopic> queryEventAndTopic(String tenantCode);


}
